package com.start.client.app.vo;

import com.start.client.app.entity.ClientAppVersionEntity;
import lombok.Data;

@Data
public class AppVersionResult {
    private String appId;
    private String appVersionDescribe;
    private Integer version;
    private String url;
    private boolean appForceUpdate;

    public static AppVersionResult appVersionToResult(ClientAppVersionEntity entity, String downloadUrl, String appId) {
        AppVersionResult result = new AppVersionResult();
        result.setVersion(entity.getAppVersionCode());
        result.setAppVersionDescribe(entity.getAppVersionDescribe());
        result.setAppId(appId);
        result.setAppForceUpdate(entity.getAppForceUpdate() == 1);
        result.setUrl(downloadUrl);
        return result;
    }
}
